<template>
    <el-dialog
    title="编辑"
    :visible="isShowEditDialog"
    @close="dialogClose"
      >
    <el-form :model="ruleForm" :rules="rules" ref="bidderEditForm" label-width="100px">

      <el-row :gutter="24">
          <el-col :span="12">
              <el-form-item label="姓名" prop="name">
                  <el-input v-model="ruleForm.name"></el-input>
              </el-form-item>
          </el-col>
          <el-col :span="12">
              <el-form-item label="性别" prop="gender">
                  <el-input v-model="ruleForm.gender"></el-input>
              </el-form-item>
          </el-col>
      </el-row>

      <el-row :gutter="24">
          <el-col :span="12">
              <el-form-item label="手机号" prop="phone">
                  <el-input v-model="ruleForm.phone"></el-input>
              </el-form-item>
          </el-col>
          <el-col :span="12">
              <el-form-item label="证件类型" prop="cardType">
                  <el-select class="select" v-model="ruleForm.cardType"></el-select>
              </el-form-item>
          </el-col>
      </el-row>

      <el-row :gutter="24">
          <el-col :span="12">
              <el-form-item label="证件号" prop="cardId">
                  <el-input v-model="ruleForm.cardId"></el-input>
              </el-form-item>
          </el-col>
          <el-col :span="12">
              <el-form-item label="地址" prop="address">
                  <el-input v-model="ruleForm.address"></el-input>
              </el-form-item>
          </el-col>
      </el-row>

    </el-form>
  
    <span style="display: flex;">
          <div style="flex: 1"></div>
        <el-button @click="dialogClose">取 消</el-button>
        <el-button type="primary" @click="submitData">确 定</el-button>
    </span>
  
  </el-dialog>
  
  </template>
  
  <script>
  export default {
      data(){
          return{
              ruleForm: {
                  name: '',
                  gender: '',
                  phone: '',
                  cardType: '',
                  cardId: '',
                  address: '',
              },
              rules:{
                name:[
                      {required: true, message: '请输入'}
                  ],
                  gender:[
                      {required: false}
                  ],
                  phone:[
                      {required: true, message: '请输入'}
                  ],
                  cardType:[
                      {required: true, message: '请选择'}
                  ],
                  cardId:[
                      {required: true, message: '请输入'}
                  ],
                  address:[
                      {required: false}
                  ],
              }
          }
      },
      props:{
          isShowEditDialog:{
              type:Boolean
          },
      },
      methods: {
          dialogClose(){ 
              this.$emit('dialogClose');
          },
          submitData(){
            this.$refs.bidderEditForm.validate((valid) => {
                if (!valid) {
                    return
                }
                else {
                    this.$emit('dialogClose')
                }
            });
        },
  
      }
  }
  </script>
  
  <style scoped lang="less">
    .select{
          width: 100%;
      }
  </style>
  
  